package com.frogs.ucenter.v1.interceptor;

import java.util.Enumeration;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.frogs.system.util.ApiUrlParamEnum;

/**
 * @author wushubin
 */
public class BaseInterceptor extends HandlerInterceptorAdapter {
	
	protected String getRequestParams(HttpServletRequest request){
		StringBuilder sb = new StringBuilder();
		for (Enumeration<String> e = request.getParameterNames(); e.hasMoreElements();) {
		    String key = e.nextElement();
		    String val = request.getParameter(key);
		    if (ApiUrlParamEnum.password.getParamName().equals(key) || ApiUrlParamEnum.confirmPassword.getParamName().equals(key)
		    		|| ApiUrlParamEnum.oldPassword.getParamName().equals(key)) {
		    	val = "******";
		    }
		    sb.append(key).append("=").append(val).append("&");
		}
		return sb.toString();
	}
	
}

